package br.com.felix.fwt.ui.javascript;

import br.com.felix.fwt.ui.BaseComponent;


/**
 * The Class MoveTo is a Javascript to alter the top and left properties of a component.
 */
public class MoveTo extends Javascript {
	
	/** The javascript. */
	private String javascript;
	
	/**
	 * Instantiates a new move to.
	 * 
	 * @param component the component that will be moved.
	 * @param top the new top value.
	 * @param left the new left value.
	 */
	public MoveTo(BaseComponent component, int top, int left){
		javascript = "document.getElementById('"+component.getName()+"').style.top = '"+top+"px'; ";
		javascript += "document.getElementById('"+component.getName()+"').style.left = '"+left+"px'; ";
	}
	
	
	/**
	 * @see br.com.felix.fwt.ui.javascript.Javascript#script()
	 */
	@Override
	public String script() {
		return javascript;
	}

}
